﻿
Imports osi.root.utt
Imports osi.root.connector

Friend Class threadpool_perf
    Inherits threadpool_case
    Implements icase

    Public Sub New(ByVal base_size As Int64, ByVal max_fake_ticks As Int64)
        MyBase.New(base_size * If(isreleasebuild(), 100, 1),
                   Sub()
                       fake_processor_ticks_work(rnd_int(0, max_fake_ticks))
                   End Sub)
    End Sub

    Public Function preserved_processors() As Int16 Implements icase.preserved_processors
        Return Environment.ProcessorCount()
    End Function

    Public Shadows Function run() As Boolean Implements icase.run
        Return MyBase.run()
    End Function
End Class

Public Class threadpool_perf_10
    Inherits case_wrapper

    Public Sub New()
        MyBase.New(New threadpool_perf(62500, 10))
    End Sub
End Class

Public Class threadpool_perf_100
    Inherits case_wrapper

    Public Sub New()
        MyBase.New(New threadpool_perf(25000, 100))
    End Sub
End Class

Public Class threadpool_perf_1000
    Inherits case_wrapper

    Public Sub New()
        MyBase.New(New threadpool_perf(10000, 1000))
    End Sub
End Class

Public Class threadpool_perf_10000
    Inherits case_wrapper

    Public Sub New()
        MyBase.New(New threadpool_perf(2000, 10000))
    End Sub
End Class

Public Class threadpool_perf_100000
    Inherits case_wrapper

    Public Sub New()
        MyBase.New(New threadpool_perf(400, 100000))
    End Sub
End Class

Public Class threadpool_perf_1000000
    Inherits case_wrapper

    Public Sub New()
        MyBase.New(New threadpool_perf(80, 1000000))
    End Sub
End Class
